package com.ikingtech.framework.sdk.dict.api;

import com.ikingtech.framework.sdk.base.model.BatchParam;
import com.ikingtech.framework.sdk.base.model.DragOrderParam;
import com.ikingtech.framework.sdk.core.response.R;
import com.ikingtech.framework.sdk.dict.model.DictItemDTO;
import com.ikingtech.framework.sdk.dict.model.DictItemQueryParamDTO;
import com.ikingtech.framework.sdk.web.annotation.PostRequest;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author tie yan
 */
public interface DictItemApi {

    @PostRequest(order = 1, value = "/add", summary = "新增", description = "新增，新增成功后返回编号。")
    R<String> add(@Parameter(name = "item", description = "字典项信息")
                  @RequestBody DictItemDTO item);

    @PostRequest(order = 2, value = "/delete", summary = "删除", description = "删除。")
    R<Object> delete(@Parameter(name = "id", description = "编号")
                     @RequestBody String id);

    @PostRequest(order = 3, value = "/update", summary = "更新", description = "更新。")
    R<Object> update(@Parameter(name = "item", description = "字典项信息")
                     @RequestBody DictItemDTO item);

    @PostRequest(order = 4, value = "/list/page", summary = "分页查询", description = "分页查询，没有查询结果时返回空列表。")
    R<List<DictItemDTO>> page(@Parameter(name = "queryParam", description = "查询条件")
                              @RequestBody DictItemQueryParamDTO queryParam);

    @PostRequest(order = 5, value = "/list/all", summary = "全量查询", description = "全量查询，没有查询结果时返回空列表。")
    R<List<DictItemDTO>> all();

    @PostRequest(order = 6, value = "/detail/id", summary = "查询详情", description = "查询详情，数据不存在时仍然返回成功,数据为null。")
    R<DictItemDTO> detail(@Parameter(name = "id", description = "编号")
                          @RequestBody String id);

    @PostRequest(order = 13, value = "/list/dict-id", summary = "查询字典项列表(字典编号)", description = "查询字典项列表(字典编号)，没有查询结果时返回空列表。")
    R<List<DictItemDTO>> listByDictId(@Parameter(name = "dictId", description = "字典编号。")
                                      @RequestBody String dictId);

    @PostRequest(order = 13, value = "/list/dict-codes", summary = "查询字典项列表(字典code集合)", description = "查询字典项列表(字典编号)，没有查询结果时返回空列表。")
    R<List<DictItemDTO>> listByDictCodes(@Parameter(name = "dictCodes", description = "字典code集合。")
                                         @RequestBody BatchParam<String> dictCodes);

    @PostRequest(order = 21, value = "/drag", summary = "拖拽排序", description = "拖拽排序，调用拖拽排序接口后需再次调用列表查询接口展示最新排序结果。")
    R<Object> drag(@Parameter(name = "dragParam", description = "拖拽参数。")
                   @RequestBody DragOrderParam dragParam);
}
